package com.xcc.cloud.sentinel.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

@RestController
public class FlowLimitController {

    @GetMapping("/testA")
    public String testA() {
        return "------testA";
    }

    //测试线程数
    @GetMapping("/testB")
    public String testB() {
        System.out.println("当前线程名为: "+Thread.currentThread().getName()+"\t时间为:"+System.currentTimeMillis());
        try {  TimeUnit.MILLISECONDS.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); }
        return "------testB";
    }

    //测试RT
    @GetMapping("/testC")
    public String testC(){
        System.out.println("当前线程名为: "+Thread.currentThread().getName()+"\t时间为:"+System.currentTimeMillis());
        try {  TimeUnit.MILLISECONDS.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); }
        return "------testC";
    }

    //测试 异常比例 和异常数
    @GetMapping("/testD")
    public String testD() {
        int age = 10/0;
        return "------testD";
    }
}
